package model;

/**
 * Created by eleven on 16/1/2.
 */
public class VmModel {

    public String CreatFront(String name,String type,String path){
        String text="<div class=\"inner bg-light lter\">\n" +
                "    <div class=\"row\">\n" +
                "        <!-- .col-lg-12 -->\n" +
                "        <div class=\"col-lg-12\">\n" +
                "            <header>\n" +
                "                <h5>"+name+"</h5>\n" +
                "            </header>\n" +
                "\n" +
                "            <nav class=\"navbar navbar-default\">\n" +
                "                <div class=\"container-fluid container-fluid-datacenter\">\n" +
                "                    <!-- Collect the nav links, forms, and other content for toggling -->\n" +
                "                    <div class=\"collapse navbar-collapse navbar-collapse-datacenter\" id=\"bs-example-navbar-collapse-1\">\n" +
                "                        <ul class=\"nav navbar-nav\">\n" +
                "                            <li #if($ruleType == \""+type+"\")class=\"active\" #end><a href=\"$app/"+path+".htm\">"+name+"<span class=\"sr-only\">(current)</span></a></li>\n" +
                "                        </ul>\n" +
                "                    </div>\n" +
                "                </div>\n" +
                "            </nav>\n" +
                "        </div>\n" +
                "    </div>\n" +
                "    <hr>\n" +
                "    #if($ruleType == \""+type+"\")\n" +
                "        #parse(\""+path+".vm\")\n" +
                "    #end\n" +
                "</div>\n" +
                "\n";

        return text;
    }

    public String CreatMinor(String name,String path, String str, String str2){
        String text="<script>\n" +
                "    $(function () {\n" +
                "        $('#dataTable').dataTable({\n" +
                "            \"oLanguage\": {\n" +
                "                \"sLengthMenu\": \"每页显示 _MENU_ 条记录\",\n" +
                "                \"sZeroRecords\": \"对不起，没有匹配的数据\",\n" +
                "                \"sInfo\": \"第 _START_ - _END_ 条 / 共 _TOTAL_ 条数据\",\n" +
                "                \"sInfoEmpty\": \"没有匹配的数据\",\n" +
                "                \"sInfoFiltered\": \"(数据表中共 _MAX_ 条记录)\",\n" +
                "                \"sProcessing\": \"正在加载中...\",\n" +
                "                \"sSearch\": \"全文搜索：\",\n" +
                "                \"oPaginate\": {\n" +
                "                    \"sFirst\": \"第一页\",\n" +
                "                    \"sPrevious\": \" 上一页 \",\n" +
                "                    \"sNext\": \" 下一页 \",\n" +
                "                    \"sLast\": \" 最后一页 \"\n" +
                "                }\n" +
                "            },\n" +
                "            \"bSort\": false,\n" +
                "            \"bFilter\": false,\n" +
                "            \"bAutoWidth\": false,\n" +
                "            \"bLengthChange\": false,\n" +
                "            \"scrollX\": true\n" +
                "//            \"sScrollX\": \"10000%\",\n" +
                "//            \"sScrollXInner\": \"10000%\"\n" +
                "        });\n" +
                "    });\n" +
                "</script>\n" +
                "\n" +
                "<script type=\"text/javascript\">\n" +
                "    $(function () {\n" +
                "        $('#dp1').datepicker({\n" +
                "            format: 'yyyy-mm-dd'\n" +
                "        });\n" +
                "        $('#dp2').datepicker({\n" +
                "            format: 'yyyy-mm-dd'\n" +
                "        });\n" +
                "    });\n" +
                "</script>\n" +
                "##<div class=\"inner bg-light lter\">\n" +
                "<div class=\"row\">\n" +
                "    <!-- .col-lg-12 -->\n" +
                "    <div class=\"col-lg-12\">\n" +
                "        <header>\n" +
                "            <h5>"+name+"</h5>\n" +
                "        </header>\n" +
                "        <!-- .box -->\n" +
                "        <div class=\"box\">\n" +
                "            <header>\n" +
                "                <div class=\"icons\">\n" +
                "                    <i class=\"fa fa-calendar\"></i>\n" +
                "                </div>\n" +
                "                <h5>日期选择</h5>\n" +
                "            </header>\n" +
                "            <div id=\"datePickerBlock\" class=\"body collapse in\" aria-expanded=\"true\">\n" +
                "                <form class=\"form-inline\" method=\"post\" action=\"$app/"+path+".htm\">\n" +
                "                    <div class=\"form-group\">\n" +
                "                        <label class=\"control-label\" for=\"dp1\">选择日期:\n" +
                "                        </label>\n" +
                "\n" +
                "                        <div class=\"input-group\">\n" +
                "                            <input type=\"text\" value=\"$!start\" class=\"form-control\" name=\"start\" id=\"dp1\">\n" +
                "                                <span class=\"input-group-addon\">\n" +
                "                                    <i class=\"fa fa-calendar-o\"></i>\n" +
                "                                </span>\n" +
                "                        </div>\n" +
                "\n" +
                "                        <div class=\"input-group\">\n" +
                "                            <input type=\"text\" value=\"$!end\" class=\"form-control\" name=\"end\" id=\"dp2\">\n" +
                "                                <span class=\"input-group-addon\">\n" +
                "                                    <i class=\"fa fa-calendar-o\"></i>\n" +
                "                                </span>\n" +
                "                        </div>\n" +
                "\n" +
                "                        <button type=\"submit\" class=\"btn btn-sm btn-danger colorpicker-element\" id=\"cp4\">查询</button>\n" +
                "                        <button type=\"button\" class=\"btn btn-sm btn-danger colorpicker-element\" id=\"btn-export\">导出</button>\n" +
                "                    </div>\n" +
                "                </form>\n" +
                "            </div>\n" +
                "        </div>\n" +
                "    </div>\n" +
                "</div>\n" +
                "<hr>\n" +
                "<div class=\"row\">\n" +
                "    <!-- .col-lg-6 -->\n" +
                "    <div class=\"col-md-12\">\n" +
                "        <div id=\"optionalTable\" class=\"table-responsive\">\n" +
                "            <table id=\"dataTable\" class=\"table table-datacenter\">\n" +
                "                <thead>\n" +
                "                <tr>\n" +str+
                "                </tr>\n" +
                "                </thead>\n" +
                "                <tbody style=\"text-align: center\">\n" +
                "                    #if($data && $data.size()>0)\n" +
                "                        #foreach($item in $data)\n" +
                "                        <tr>\n" +str2+
                "                        </tr>\n" +
                "                        #end\n" +
                "                    #end\n" +
                "                </tbody>\n" +
                "            </table>\n" +
                "        </div>\n" +
                "    </div>\n" +
                "</div>\n" +
                "##</div>\n" +
                "<script>\n" +
                "    $(function () {\n" +
                "        $('#btn-export').click(function () {\n" +
                "            window.location.href = \"$app/"+path+".do?start=\" + $('#dp1').val() + \"&end=\" + $('#dp2').val();\n" +
                "        })\n" +
                "    });\n" +
                "</script>\n";
        return text;
    }
}
